<?xml version="1.0" encoding="UTF-8"?>
<%@page contentType="text/html; charset=UTF-8" %>
<%
	// Liste des utilisateurs
	Session hSession = HibernateUtil.getSessionFactory().getCurrentSession();
	Collection<User> users = hSession.createCriteria(User.class).list();
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
	<title>Bookstore :: Back office :: Utilisateurs</title>
	<%@include file="include.jsp" %>
</head>

<body>
	<%@include file="commun.jsp" %>
	
	<div class="contenuAvecMenu">
		<h2>Utilisateurs</h2>
		<div class="boite bleue">
			<img src="../resources/images/add.png" alt="" />
			<a href="editUser.jsp?action=ADD">Ajouter un utilisateur</a>
			<table>
				<tr>
					<th class="moyenne">Identifiant</th>
					<th class="large">Nom d'utilisateur</th>
					<th class="large">Nom</th>
					<th class="large">Prenom</th>
					<th class="etroite">Administrateur</th>
					<th class="moyenne">Actions</th>
				</tr>
				<% for (User user : users) { %>
				<tr>
					<td class="centree"><%=user.getId()%></td>
					<td><%=user.getUserName()%></td>
					<td><%=user.getLastName()%></td>
					<td><%=user.getFirstName()%></td>
					<td class="centree"><%=user.getAdmin() ? "Oui" : "Non"%></td>
					<td class="centree">
						<a href="editUser.jsp?action=EDIT&amp;id=<%=user.getId()%>" title="Modifier">
							<img src="../resources/images/pencil.png" alt="Modifier" />
						</a>
						&middot;
						<a href="RemoveUser.do?id=<%=user.getId()%>" title="Supprimer">
							<img src="../resources/images/delete.png" alt="Supprimer" />
						</a>
					</td>
				</tr>
				<% } %>
			</table>
		</div>
	</div>
</body>
</html>
